package com.ssy.lingxi.order.entity;

import com.ssy.lingxi.order.handler.converter.JpaJsonToOrderConfigConverter;
import com.ssy.lingxi.order.model.bo.OrderConfigBO;

import javax.persistence.*;

/**
 *  订单参数配置[积分抵扣订单][满额包邮]
 *  系统能力->参数配置
 *  平台后台->系统管理->业务参数配置
 * @author ds
 * @date 2022/2/17
 * @version 2.0.0
 */
@Entity
@Table(schema = "public", name = "ord_base_order_config",
        indexes = {@Index(name = "ord_base_order_config_type_member_id_member_role_id_idx", columnList = "type,memberId,memberRoleId",unique = true),
                })
public class BaseOrderConfigDO {
    /**
     * 主键Id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ord_base_order_config_seq")
    @SequenceGenerator(sequenceName = "ord_base_order_config_seq", name = "ord_base_order_config_seq", allocationSize = 1)
    private Long id;

    /**
     * 业务类型：BaseOrderConfigEnum
     * [积分抵扣订单][满额包邮]
     */
    @Column
    private Integer type;

    /**
     * 会员id
     */
    @Column
    private Long memberId;

    /**
     * 会员角色id
     */
    @Column
    private Long memberRoleId;

    /**
     * 状态，0-停用，1-启用
     */
    @Column
    private Integer status;

    /**
     * 具体配置参数
     */
    @Convert(converter = JpaJsonToOrderConfigConverter.class)
    @Column(columnDefinition = "jsonb")
    private OrderConfigBO configBO;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getMemberId() {
        return memberId;
    }

    public void setMemberId(Long memberId) {
        this.memberId = memberId;
    }

    public Long getMemberRoleId() {
        return memberRoleId;
    }

    public void setMemberRoleId(Long memberRoleId) {
        this.memberRoleId = memberRoleId;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public OrderConfigBO getConfigBO() {
        return configBO;
    }

    public void setConfigBO(OrderConfigBO configBO) {
        this.configBO = configBO;
    }
}
